import { request } from "./request";

// 查询appBy Type
export function getAppByType(data) {
  return request({
    url: "/app/type/" + data,
    method: "get"
  });
}

// 提交apk
export function apk(fromData) {
  return request({
    url: "/app/apk",
    method: "post",
    data: fromData,
    header: { "Content-Type": "form-data" },
    async: false
  });
}

//删除app
export function removeApp(id) {
  return request({
    url: "/app/" + id,
    method: "delete"
  });
}

//更新app
export function putApp(data) {
  return request({
    url: "/app/",
    method: "put",
    data: data
  });
}

//删除图片
export function delPicture(name, id) {
  return request({
    url: "/app/picture?id=" + id + "&picture=" + name,
    method: "delete"
  });
}

//更新apk
export function putApk(fromData, progress) {
  return request({
    url: "/app/newApk",
    method: "post",
    data: fromData,
    timeout: 1000 * 60 * 60,
    header: { "Content-Type": "form-data" },
    onUploadProgress(e) {
      progress(e);
    }
  });
}
